/**
 * Created by charlie on 18-1-11.
 */
import React from 'react'
import {StyleSheet,Text,View,TextInput,TouchableOpacity,} from 'react-native'
import Dialog from '../../routes/DialogTip'
export default class index extends React.Component{
    render(){
        const {change,edit} = this.props;
        let userName = this.props.editPwd.userName;
        let oldPwd = this.props.editPwd.oldPwd;
        let newPwd = this.props.editPwd.newPwd;
        let newPwdSure = this.props.editPwd.newPwdSure;
        let dialogText = this.props.editPwd.dialogText;
        return(
            <View style={styles.thisMianView}>
                <View style={{flexDirection:'row',justifyContent:'flex-start',}}>
                    <Text style={styles.thisTextName}>
                        登录名称:
                    </Text>
                    <Text style={styles.thisText}>
                        {userName}
                    </Text>
                </View>
                <View style={{flexDirection:'row'}}>
                    <Text style={styles.thisTextName} >
                        请输入原密码:
                    </Text>
                    {/*<View style={{borderWidth:1,borderColor:'red',width:150,height:40,marginTop:8,*/}
                      {/*borderTopLeftRadius:5,borderBottomLeftRadius:5,borderTopRightRadius:5,borderBottomRightRadius:5}}>*/}
                    <TextInput
                         underlineColorAndroid='transparent'
                      // style={{fontSize:16,width:200,alignItems: 'flex-end',height:38,marginTop:2}}
                         style={{fontSize:14,width:200,marginTop:4}}
                        placeholder='请输入原密码'
                        maxLength={20}
                        onChangeText={(val) =>change({oldPwd:val})}
                        value={oldPwd}
                        secureTextEntry={true}
                   />
                    {/*</View>*/}
                </View>

                <View style={{flexDirection:'row'}}>
                    <Text style={styles.thisTextName}>
                        请输入新密码:
                    </Text>
                    <TextInput
                        underlineColorAndroid='transparent'
                        style={{fontSize:14,width:200,marginTop:4}}
                        placeholder='请输入新密码'
                        maxLength={20}
                        onChangeText={(val) =>change({newPwd:val})}
                        value={newPwd}
                        secureTextEntry={true}
                    />
                </View>
                <View style={{flexDirection:'row'}}>
                    <Text style={styles.thisTextName}>
                        请确认新密码:
                    </Text>
                    <TextInput
                         underlineColorAndroid='transparent'
                         style={{fontSize:14,width:200,marginTop:4}}
                        placeholder='确认密码'
                        maxLength={20}
                        onChangeText={(val) =>change({newPwdSure:val})}
                        value={newPwdSure}
                        secureTextEntry={true}
                    />
                </View>
                <TouchableOpacity onPress={edit}>
                    <View style={styles.loginButton}>
                        <Text style={styles.loginTitle}>
                            修改
                        </Text>
                    </View>
                </TouchableOpacity>
                {
                    dialogText === ''?null:
                        <Dialog isShow={'true'} text={dialogText}/>
                }

            </View>
        )
    }
}

const styles = StyleSheet.create({
    thisMianView:{
        flex:1,
        paddingRight:'20%',
        paddingLeft:'20%',
        justifyContent:'flex-start',
        flexDirection: 'column',
    },
    thisTextName:{
        color:'black',
        fontSize:18,
        paddingTop:15,
        paddingBottom:10
    },

    thisText:{
        paddingLeft:15,
        paddingTop:15,
        paddingBottom:10,
      fontSize:16
    },

    imageSize:{
        width:200,
        height:150,
        marginLeft:15,
        marginTop:15
    },
    loginButton:{
        backgroundColor:'#fe9300',
        marginTop: 30,
        borderRadius: 3,
        borderColor:'rgba(0,0,0,0)',
    },
    loginTitle: {
        color: 'white',
        fontSize: 24,
        fontWeight: 'bold',
        padding: 10,
        textAlign: 'center',
    },
})